
/** 星级 */
export enum E_CardStar {
    one = 1,
    two,
    three,
}


export class CardData {

    private static _ins: CardData = null;
    public static get ins(): CardData {
        if (CardData._ins == null) {
            CardData._ins = new CardData();
        }
        return CardData._ins;
    }

    /** 卡牌长度 */
    readonly CardArrLength: number = 7;

    /** 获得卡牌 */
    getCard() {
        // ASCII码中A的偏移量为64
        const asciiOffset = 64;
        let cardID = Math.floor(Math.random() * 3) + 1;
        let cardStar = Math.floor(Math.random() * 3) + 1;
        let name = String.fromCharCode(cardID + asciiOffset);
        return new CardStruct(cardID, cardStar, name);
    }




}

/** 卡牌结构 */
export class CardStruct {
    id: number;
    star: number;
    name: string;
    constructor(id: number, star: number, name: string) {
        this.id = id;
        this.star = star;
        this.name = name;
    }
}


